package com.os.opencv.java.chapter3;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

public class Draw3 {

    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

        //用于绘制图形的背景图
        Mat src = Imgcodecs.imread("000176_grey.png");

        //绘制边界框
        Mat dst = new Mat();
        Core.copyMakeBorder(src, dst, 9, 9, 9, 9, Core.BORDER_CONSTANT);

        //绘制箭头
        Point pt1 = new Point(760, 450);
        Point pt2 = new Point(465, 570);
        Scalar red = new Scalar(0, 0, 255);
        Imgproc.arrowedLine(dst, pt1, pt2, red, 3, Imgproc.LINE_AA, 0, 0.1);

        //在屏幕上显示绘制好的图像
        HighGui.imshow("dst", dst);
        HighGui.waitKey(0);
        System.exit(0);
    }
}
